<template>
  <el-card class="box-card h100" :style="themeOpacity">
    <div slot="header" :class="['clearfix', isDraggable ? 'draggable-move-clazz' : '']">
      <span>图书馆信息列表</span>
      <el-button style="float: right; padding: 3px 0" type="text" @click="delCard"  v-show="isDraggable">删除</el-button>
    </div>
    <div class="card-vertical">
      <el-row :gutter="5" class="book-info">
        <el-col :span="12" class="card-two-item align-center">
          <img src="@/assets/images/book.png" alt="" />
        </el-col>
        <el-col :span="12" class="card-two-item align-center">
          <div class="mb10">
            <span class="card-item-text">可外借数：</span>
            <span class="card-item-num">10</span>
          </div>
          <div class="mb10">
            <span class="card-item-text">已外借数：</span>
            <span class="card-item-num">0</span>
          </div>
          <div class="mb10">
            <span class="card-item-text">剩余外借数：</span>
            <span class="card-item-num">10</span>
          </div>
        </el-col>
      </el-row>
      <el-row class="align-center">
        <a-button type="primary" @click="$router.push({ path: '/client/librarySearch' })">搜索书籍</a-button>
      </el-row>
    </div>
  </el-card>
</template>

<script>
  import { mixin } from '@/mixin'
  import { color2Hex } from '@/utils/themeUtils'
  export default {
    name: 'BookList',
    data() {
      return {}
    },
    props: {
      isDraggable: {
        type: Boolean,
        default: false
      },
      dataSource: {
        type: Object,
        default: () => {}
      }
    },
    methods: {
      delCard() {
        this.$emit('delCard', this.dataSource);
      },
    },
    mixins: [mixin]
  }
</script>

<style scoped lang="scss">
  .card-two-item {
    padding-bottom: 10px;
    .el-link {
      line-height: 26px;
      .icon-image {
        margin-right: 10px;
      }
    }
    .card-item-text {
      line-height: 30px;
      display: inline-block;
      width: calc(100% - 50px);
      text-align: left;
    }

    .card-item-num {
      display: inline-block;
      width: 50px;
      text-align: left;
    }
  }
  .card-vertical {
    display: flex;
    height: 100%;
    flex-direction: column;
    justify-content: space-between;
    .book-info {
      width: 100%;
      display: flex;
      align-items: center;
      height: calc(100% - 30px);
    }
  }
  .align-center {
    margin-top: 8px;
    text-align: center;
  }
</style>
